UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgAqxj2J2avpWw+ROJmGRe6OYS7NKWmH8pOEwWZMu9Y='
WHERE
key_id = 'e59d2f31e923e606a46a5cabff54cda676f11480cd87f65b9ff025b07e8743c9'
AND (
token = 'SgAqxj2J2avpWw+ROJmGRe6OYS7NKWmH8pOEwWZMu9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)