UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VbULjOVGqzDbUXkPXdDbsA87fkcU3IMap5s+tNUsXAk='
WHERE
key_id = 'd490489daf3e0b2d3cfda468f60b0e200a9948b3f3a5ec9713a2c3ec7b848a17'
AND (
token = 'VbULjOVGqzDbUXkPXdDbsA87fkcU3IMap5s+tNUsXAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)