UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rDgQXZG9hRcNYz851gDcq/hRIyzT+sF1PrbBAjEyBH0='
WHERE
key_id = '0ae86e1872575a5927ecd7e16d92c2c5204e933900f31fdd5c8f248728378472'
AND (
token = 'rDgQXZG9hRcNYz851gDcq/hRIyzT+sF1PrbBAjEyBH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)