UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5B9ZCxnraE+OXgs6sxJU7CZiF8hhJ81Wghe1LRht5JU='
WHERE
key_id = 'c8405050d09dd887e31468b1ffe29e65e702ea1fda6a6db785d223b1528c9e9d'
AND (
token = '5B9ZCxnraE+OXgs6sxJU7CZiF8hhJ81Wghe1LRht5JU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)