UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Im8XX3u5DNvk/g85iP3CHhk2MKrLfenlLeMELi696yI=' 
WHERE 
  key_id = 'f34daea889ac35e20415fe8300a100c2fb9d89afd8b2d15f887adc41c6cd288e' 
  AND (
    token = 'Im8XX3u5DNvk/g85iP3CHhk2MKrLfenlLeMELi696yI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046