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