UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CfVlvmZgNMTEwMV3nok3ZbaepTXVd9tL4D074nT4+dk='
WHERE
key_id = '0dd858463e315e88dfd502d41f43de4a234925722e1a5247a7139837daedfa0b'
AND (
token = 'CfVlvmZgNMTEwMV3nok3ZbaepTXVd9tL4D074nT4+dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)