UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZP8bVuF6G49pxHVGWoN7Q/o2CyudRxoGmxh+KqpYgE=' 
WHERE 
  key_id = 'd51b661903150522b9c93d9f7f14048b1f9434304003a9b808100cbd3923eaf5' 
  AND (
    token = 'TZP8bVuF6G49pxHVGWoN7Q/o2CyudRxoGmxh+KqpYgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023