UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q7OO8TASK+0gUHQ5HOKB+cqqeVNndSo/bcoMupOd1S4='
WHERE
key_id = 'e5e05b41507d742824e3026d946570a76986072436c5b606864338291fe30939'
AND (
token = 'q7OO8TASK+0gUHQ5HOKB+cqqeVNndSo/bcoMupOd1S4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)