UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RP7/8zZD+xUplF7JGsCcrhCAYyfe/KYv+Sjs549i6VE='
WHERE
key_id = 'c97803c5923860b35556e0bf81338ea93cd90996e6b018632f6cf520afdbb6d4'
AND (
token = 'RP7/8zZD+xUplF7JGsCcrhCAYyfe/KYv+Sjs549i6VE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)