UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c3SZPjo4Cx5CZMy76KBBzyEX7bJQua6W84LY2XOgEnQ='
WHERE
key_id = 'e9f2589c4d6a42d684c933cad876ba28b7790283dc12071162cbdaf5f33eebd1'
AND (
token = 'c3SZPjo4Cx5CZMy76KBBzyEX7bJQua6W84LY2XOgEnQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)