UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AG1xmJKBGxkfrtDPVKtqw1w8lmdQ0HqxKJg4Uy4fvr8=' 
WHERE 
  key_id = 'e82dc8b9152315acd10b09fe034ffec2ef927b705ddf626cd7e9d6f2d27f31b5' 
  AND (
    token = 'AG1xmJKBGxkfrtDPVKtqw1w8lmdQ0HqxKJg4Uy4fvr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025