UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/8nGaon2hNaVX8HzJZSuj81D9GyW3AvQYoUvmK4gCU0='
WHERE
key_id = '87681448ae632791f3512c115ae67437c32b12ba41f0686c937f5be263d2bcb1'
AND (
token = '/8nGaon2hNaVX8HzJZSuj81D9GyW3AvQYoUvmK4gCU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)