UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '24J8evvq3vVtCvVU6GedLk3IZ7oisfok1FAO8BZ3MLo=' 
WHERE 
  key_id = '2b3b020c778483b70a6e48c934910a5e01b0d48b4f7fd059517ac4ecd32351ca' 
  AND (
    token = '24J8evvq3vVtCvVU6GedLk3IZ7oisfok1FAO8BZ3MLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022