UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FSc7HN12ZF5xqKP37beMZHnvPvkk+9uPkfjmV67pI6w='
WHERE
key_id = 'a496d95504d6fc7cb38d811d4b3b743f5c6ec1c6393a7c5507243b872ac73872'
AND (
token = 'FSc7HN12ZF5xqKP37beMZHnvPvkk+9uPkfjmV67pI6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)