UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uY+/sMJ2eGPnmhuwRg8YRnrYsHLOgPokY5WowTsf1bY=' 
WHERE 
  key_id = 'd5ea193ee79472c26ccdae457037c959dc823c0ea669f675e63529e634de9247' 
  AND (
    token = 'uY+/sMJ2eGPnmhuwRg8YRnrYsHLOgPokY5WowTsf1bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045