UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KYtpWIis8a2Q5koDYpXqYfIKSpdV0P2i9v7VifxEZxo=' 
WHERE 
  key_id = '60eb642d24a19a6684b3488213199b5803992da02fb318b4640cf545380ff7d9' 
  AND (
    token = 'KYtpWIis8a2Q5koDYpXqYfIKSpdV0P2i9v7VifxEZxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058