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