UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tCDknNUXBru1YQsLSqc4KoB18tBiWItbA7Li+lNBwbk=' 
WHERE 
  key_id = '9933b81ed67cb41d74a8913a4ad977855fd1c7629952757deeb3b18a77e647b0' 
  AND (
    token = 'tCDknNUXBru1YQsLSqc4KoB18tBiWItbA7Li+lNBwbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040