UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DA5tmkFl+fT+o1LGr8qHbW/OzZ02YUf3D0yNokw79Cc=' 
WHERE 
  key_id = '1e69726d2a4599f8e6dc2e727835337918eebe8073a3bcda7975143914523171' 
  AND (
    token = 'DA5tmkFl+fT+o1LGr8qHbW/OzZ02YUf3D0yNokw79Cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037