UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i9wOnJN7WLhZgLYHOU6PGLJ8gDMg9V8IFYSqk4Not14='
WHERE
key_id = '5cc816e9b11e38a12226edcb9a875225c9c901952b23f6009a9c547ef02b8aec'
AND (
token = 'i9wOnJN7WLhZgLYHOU6PGLJ8gDMg9V8IFYSqk4Not14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)