UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Lb6I+w1ndF1tjj3XsQ20lZARs5GOlsdaO9zKTW04rI='
WHERE
key_id = 'd5aa9fa2a153a1105a78e51c2d55641bddddec24348836dccce5426f8571c7ee'
AND (
token = '0Lb6I+w1ndF1tjj3XsQ20lZARs5GOlsdaO9zKTW04rI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)