UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O32mI+VGW8FCXswQICPQW7RfZwAbOILmdjjASK+QCmw=' 
WHERE 
  key_id = '680f187dcc59b8d3a61f829a9724de3e5d73d93d8c1ca9f14aa628efa98521e0' 
  AND (
    token = 'O32mI+VGW8FCXswQICPQW7RfZwAbOILmdjjASK+QCmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041