UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P2e4c6pwCte3V/oKEFUnc9qISFkiJq6V5N+Gdb3LxaM=' 
WHERE 
  key_id = '688613deb26ddeacd692adf6d90fe8115e2c5086d8bfa42ddb3d612b7791c7c9' 
  AND (
    token = 'P2e4c6pwCte3V/oKEFUnc9qISFkiJq6V5N+Gdb3LxaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030