UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K9XPg5j+qIkHbQL3VupC+oCBeZ4C5gzmjghrzyJPIjg='
WHERE
key_id = '7abeeb04e525458adbad99ac7577bb2ab4f701209eacf3a2be04a1bf91c3cc19'
AND (
token = 'K9XPg5j+qIkHbQL3VupC+oCBeZ4C5gzmjghrzyJPIjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)