UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DwBOswsnNfPMvJB9QYFbl5lBO3KbiiLO3f8ov7GfE0k=' 
WHERE 
  key_id = '161c37a660f1fa8b18cbac874e1062c6ae0099ad18c954343f9b7582f66fc0c2' 
  AND (
    token = 'DwBOswsnNfPMvJB9QYFbl5lBO3KbiiLO3f8ov7GfE0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050