UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+KqQYQEkavewgMf5b7dxnlYB7dRCXzn1nfpHzUk6LI=' 
WHERE 
  key_id = 'baf3306f20cefa5434fed30f5774ac3ddd4d003b61af9b512991cc53458ec06e' 
  AND (
    token = 'c+KqQYQEkavewgMf5b7dxnlYB7dRCXzn1nfpHzUk6LI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038