UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6UgBe+9M2OU9Yzb2ZFeqhemUhupL5r2Pnz7giqJ2fj8='
WHERE
key_id = '9f8a53bf9c38f6861cba88d0a4223e8be48d2c54c0e05a5a4f4a7602860eec5a'
AND (
token = '6UgBe+9M2OU9Yzb2ZFeqhemUhupL5r2Pnz7giqJ2fj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)