UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nFwYeQr5AfjVTucD0fC32r6cYq9TARrmwrPVrQwyJdk='
WHERE
key_id = 'a8814f55898c1b8fa5f4f7ea0ff38d057f2e8cd2752d45a7c0596f96d45fa297'
AND (
token = 'nFwYeQr5AfjVTucD0fC32r6cYq9TARrmwrPVrQwyJdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)