UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm9F93FUP+9+nWSSEZMvcQ0m6cUfv1sbE+8v4Pjsg7Ic='
WHERE
key_id = 'c5904518cc915a8b081c42f272cc638babaedfa68e653e1d94663431e7b1891f'
AND (
token = 'm9F93FUP+9+nWSSEZMvcQ0m6cUfv1sbE+8v4Pjsg7Ic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)