UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Er8tZQys+a39HOl/bTiqT4vkp/XeuUiRpBiTjhVJHV8=' 
WHERE 
  key_id = '38c854ee8f46bda8a5e631336d8d673934f7f0a04a74a2e0a2501a15279ea9b4' 
  AND (
    token = 'Er8tZQys+a39HOl/bTiqT4vkp/XeuUiRpBiTjhVJHV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021