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