UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDylLa6gc8hVYDI7D2krLpNVF7pjV9bG8bowHKm/XdA=' 
WHERE 
  key_id = '300c839e073ecf95ebe0f98cfaa26e31affe1178957a5b98c1f2f885643f887f' 
  AND (
    token = 'SDylLa6gc8hVYDI7D2krLpNVF7pjV9bG8bowHKm/XdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035