UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kdt1aAMAkx3lhwVBGJUjXabwH957VtRHDEIN987sars=' 
WHERE 
  key_id = '75ec311c77f997e0c73d0390babc420b24390c4089d02ded4df3bc07458e5da2' 
  AND (
    token = 'kdt1aAMAkx3lhwVBGJUjXabwH957VtRHDEIN987sars=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036