UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gg3shZDiBULJ272DKlYQxVCdDJlp3ernUEcUDHUe+l8=' 
WHERE 
  key_id = 'f0da184f4a03a2d8281877d2fe7f247f95c1fa28a8e242e5c3fa8b7db69c3858' 
  AND (
    token = 'gg3shZDiBULJ272DKlYQxVCdDJlp3ernUEcUDHUe+l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015