UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gna6tte9/U0ean5gbaGoebiW8tDC6viWYSJfySnI5/8='
WHERE
key_id = 'a8ad9847625457774eaf38b8a4c38e525a373a1453f6df6a1fb6862e809e65d3'
AND (
token = 'Gna6tte9/U0ean5gbaGoebiW8tDC6viWYSJfySnI5/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)