UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A0S5azahtyLQfOC9FLQ/NJzcdUhqNX+5xAy8+16Xavw='
WHERE
key_id = 'b03f1144ee073eb3ec7c53c7c55ef8ad86055675f05f5486df7d42a047c18775'
AND (
token = 'A0S5azahtyLQfOC9FLQ/NJzcdUhqNX+5xAy8+16Xavw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)