UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vF2w3NTzBDYkFRxY3/TqLlVUKIyFFDS/CakIQjLp2nk='
WHERE
key_id = 'e89348291ec5c1204dacc8e7644b58a724775d270539d7086f3cf9ac47d07fb2'
AND (
token = 'vF2w3NTzBDYkFRxY3/TqLlVUKIyFFDS/CakIQjLp2nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)