UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzWcu7Ja+kWUoc/CTQdgtWURuOg7M62yYjcSzeCyXi0=' 
WHERE 
  key_id = '94dd8288c002c8f0ab7839a679b3f8e488fa63591b29cdd5b0d9fe3a0eb738df' 
  AND (
    token = 'XzWcu7Ja+kWUoc/CTQdgtWURuOg7M62yYjcSzeCyXi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027