UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '38ed8WrwV59tGQ1Bexn5ErI7mvVUpXHRdFni+2VoHyg='
WHERE
key_id = 'cb29f15f1227540e9e44f989390006fc33aa74308e1bfca752b1b6565db522df'
AND (
token = '38ed8WrwV59tGQ1Bexn5ErI7mvVUpXHRdFni+2VoHyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)