UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fad8ZA3WM2MRnMC8H0nQL90OudgPFsQTkhPJ5LWf9/Y=' 
WHERE 
  key_id = '20c2ddc9ce6690bc111f41325b5993f757dd3a0156e3f281fdcdfff65ebfab56' 
  AND (
    token = 'Fad8ZA3WM2MRnMC8H0nQL90OudgPFsQTkhPJ5LWf9/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030