UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gEg3MjP+rP5OjLIbBrsGtk1QDtElCVTkiQdNUCoyEjQ=' 
WHERE 
  key_id = 'bc962a6a0d3d5ed787f2c53f47c40412e9a5cd8f5f84d386cf9ae5f760d24d47' 
  AND (
    token = 'gEg3MjP+rP5OjLIbBrsGtk1QDtElCVTkiQdNUCoyEjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020