UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkz/hzhNxUrHxaqXupLBOVuJV8hLnM1rgTrWZhXEXc0=' 
WHERE 
  key_id = '780808a3741a7596df7d8c5c80487313d9745e7334c9733a771b68ad47bffcc6' 
  AND (
    token = 'gkz/hzhNxUrHxaqXupLBOVuJV8hLnM1rgTrWZhXEXc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039