UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UA8W2eH/WPWQesz6mWLy9TTU0JCt07OdBu2H350G/L4=' 
WHERE 
  key_id = '9a64e6d0aed28ed0be89a051aab8094246bf553c81fe1081c7d37155172ee954' 
  AND (
    token = 'UA8W2eH/WPWQesz6mWLy9TTU0JCt07OdBu2H350G/L4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022