UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R0APF4QZatru4p7+Uwci3CJdfIB7uDTFkcdmdw7wOhI='
WHERE
key_id = 'f35d842238242d62bf88af15b7953ee80a4abd48dc32eb64d7ecbb6ee2d6fcd7'
AND (
token = 'R0APF4QZatru4p7+Uwci3CJdfIB7uDTFkcdmdw7wOhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)