UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x0KhtooJjX8O8+OblKdIo56AqEgb8fcHPIhs1jlGFV4='
WHERE
key_id = 'ec9878eb3e62707b570a2328fba6c650c897bd8f0f6822666050fd9289620cbd'
AND (
token = 'x0KhtooJjX8O8+OblKdIo56AqEgb8fcHPIhs1jlGFV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)