UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2XcWnGA6sEjYNyddEJYr+CqsVk/YBycEwtV5Ray8Mb8='
WHERE
key_id = '1f10eed1b505100286abd022ec6f5b133dfc79aefc72e23069bd59c020ef786c'
AND (
token = '2XcWnGA6sEjYNyddEJYr+CqsVk/YBycEwtV5Ray8Mb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)