UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FPT4osyCCRJCI1tButUtZVLoxx1bBmL/PkbmcLHw0wM=' 
WHERE 
  key_id = '396c2764c1ed3c6f92fe38c8ed6bde21df1c0016ecfcc4ab3c86efc542315c9e' 
  AND (
    token = 'FPT4osyCCRJCI1tButUtZVLoxx1bBmL/PkbmcLHw0wM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030