UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '91G9uVcXNTlH1J71zPgCsH6C8a3BvnDxtQoOjBhJXZA='
WHERE
key_id = 'ea7046e3e8b59458a54d558df1d2f2a3075ed23e399059a6c07f7c6a643802a6'
AND (
token = '91G9uVcXNTlH1J71zPgCsH6C8a3BvnDxtQoOjBhJXZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)