UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VZunVW2PSPUhg7awzfs7qdeguVyPG1nToUvlgl8m1pc=' 
WHERE 
  key_id = '38671054c144446b2af7dd72d988798a21628a2c7cf7946dc774d67dff06375c' 
  AND (
    token = 'VZunVW2PSPUhg7awzfs7qdeguVyPG1nToUvlgl8m1pc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048