UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C5B8yjsnUkqo6SbFIX5pKnkeG8PNKwy1q4nDDWlEhww='
WHERE
key_id = '29e33076fc795fcfac871461f2e7738187e81cba6808bbfae032a1b8133b57aa'
AND (
token = 'C5B8yjsnUkqo6SbFIX5pKnkeG8PNKwy1q4nDDWlEhww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)