UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4KCKAikTVqzsL3NcjfbzK0r0O/6fS9WTn2EACERvbzw=' 
WHERE 
  key_id = '038b371e6e93d8bb1ec105d4b83ee992111ad0838351ef79e19455e18851393c' 
  AND (
    token = '4KCKAikTVqzsL3NcjfbzK0r0O/6fS9WTn2EACERvbzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022